package com.iqiyi.pps.epg.api.server.impl;

import com.iqiyi.pps.epg.api.server.iservice.SginalApiService;
import com.iqiyi.pps.epg.api.server.proxy.SginalProxy;
import com.iqiyi.pps.epg.api.utils.CrossDataLocalPool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.ws.rs.FormParam;
import javax.ws.rs.core.MultivaluedMap;


/**
 * Created by zhang on 2017/6/12.
 */
@Service("sginalApiServiceImpl")
public class SginalApiServiceImpl extends ApiServiceImpl implements SginalApiService {

    @Autowired
    private SginalProxy proxy;

    @Override
    public String createSginal(String entity) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.createSginal(entity);
    }

    @Override
    public String editSginal(String entity) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.editSginal(entity);
    }

    @Override
    public String deleteSginal(String id) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.deleteSginal(id);
    }

    @Override
    public String forceDeleteSginal( String id) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.forceDeleteSginal(id);
    }

    @Override
    public String startSginal(String id) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.startSginal(id);
    }

    @Override
    public String stopSginal(String id) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.stopSginal(id);
    }

    @Override
    public String sginalList(Integer pageNo, Integer pageSize, String id, String name, String port, String status, String author) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.sginalList(pageNo, pageSize, id, name, port, status, author);
    }

    @Override
    public String sginalLogList(Integer pageNo, Integer pageSize, String fatherId) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.sginalLogList(pageNo, pageSize, fatherId);
    }

    @Override
    public String createServer(String entity) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.createServer(entity);
    }

    @Override
    public String editServer(String entity) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.editServer(entity);
    }

    @Override
    public String deleteServer(String id) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.deleteServer(id);
    }

    @Override
    public String serverList(Integer pageNo, Integer pageSize, String id,
                             String sn, String insideServerIp, String outsideServerIp,
                             String port, String status, String serverType, String province, String city, String idc, String system,
                             String version, String hardware, String load, String remark,
                             String dataFree,String dataUsed,String allFree,String allUsed,String allMem,String availableMem,String allSwap,String freeSwap,String icmploss,
                             String monitor, String including, String cluster, String orderBy,String sort) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.serverList(pageNo, pageSize, id, sn, insideServerIp, outsideServerIp, port, status, serverType, province, city, idc, system,
                version, hardware, load, remark,
                dataFree,dataUsed,allFree,allUsed,allMem,availableMem,allSwap,freeSwap,icmploss,monitor , including, cluster, orderBy,sort);
    }

    @Override
    public String sginalStatus(String cid, String status) {
        CrossDataLocalPool.set(getCrossData());
        MultivaluedMap<String, String> multMap = uriInfo.getQueryParameters();
        return proxy.sginalStatus(multMap.getFirst("cid"), multMap.getFirst("status"));
    }

    @Override
    public String sginalStatusList(Integer pageNo, Integer pageSize, String id, String fatherId, String serverIp,String startDate,String endDate) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.sginalStatusList(pageNo, pageSize, id, fatherId, serverIp,startDate,endDate);
    }

    @Override
    public String serverStatusList(Integer pageNo, Integer pageSize, String serverId) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.serverStatusList(pageNo, pageSize, serverId);
    }

    @Override
    public String zzdServerList( String paramsObj, Integer pageNo, Integer pageSize ){
        CrossDataLocalPool.set(getCrossData());
        return proxy.zzdServerList(paramsObj, pageNo, pageSize);
    }

    @Override
    public String delVersionController(String serverId) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.delVersionController(serverId);
    }

    @Override
    public String versionHistory() {
        CrossDataLocalPool.set(getCrossData());
        return proxy.versionHistory();
    }


    @Override
    public String synVersion(String insideServerIp,String hardware,String remark) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.synVersion(insideServerIp,hardware,remark);
    }

    @Override
    public String checkInsideServerIp(String insideServerIp){
        CrossDataLocalPool.set(getCrossData());
        return proxy.checkInsideServerIp(insideServerIp);
    }

    @Override
    public String getMainVersion(){
        CrossDataLocalPool.set(getCrossData());
        return proxy.getMainVersion();
    }

    @Override
    public String setMainVersion(String versions) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.setMainVersion(versions);
    }

    @Override
    public String synVersionStatus(String versions) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.synVersionStatus(versions);
    }

    @Override
    public String clusterList(String clusterId, String clusterName, String status, String idc, Integer pageNo, Integer pageSize) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.clusterList(clusterId,clusterName,status,pageNo,pageSize);
    }

    @Override
    public String delServerCluster(String id) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.delServerCluster(id);
    }

    @Override
    public String editServerCluster(String clusterId, String clusterName, String status, String serverList,String idc) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.editServerCluster(clusterId,clusterName,status,serverList,idc);
    }

    @Override
    public String clusterSeverList(String cluster, String clusterName, Integer pageNo, Integer pageSize) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.clusterSeverList(cluster,clusterName,pageNo,pageSize);
    }

    @Override
    public String IdcServerList( String idc, Integer pageNo, Integer pageSize) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.IdcServerList(idc,pageNo,pageSize);
    }

    @Override
    public String createServerCluster(String clusterName, String status, String serverList,String idc) {
        CrossDataLocalPool.set(getCrossData());
        return proxy.createServerCluster(clusterName,status,serverList,idc);
    }


}
